package com.sandy.helloworld

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class HelloController {
    @GetMapping('/hello')
    String hello(String name) {
        // !(name != null && name.isEmpty())
        if (!name) {
            return "?name=XXX"
        }
        // name != null && name.equals("world")
        if (name == "world") {
            // System.out.println()
            println "My dear ${name}, you are wellcome."
        }
        // 方法最后的值直接作为返回值,可以省略return
        // return "hello " + name
        "hello ${name}"
    }
}
